package chapter04;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

//定义Animal类
class Animal1{
    private  String name;
    private int age;
    public String getName(){
        return name;
    }

    public  void setName (String name) {
        this.name = name;
    }
    public int getAge(){
        return age;
    }
    public void setAge(int age){
        this.age = age;
    }
}
class Dog1 extends  Animal1{
    private String color;//定义color属性
    public String getColor(){
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
//定义测试类
public class Example02 {
    public static void main(String[] args) {
        Dog1 dog1 = new Dog1();
        dog1.setName("牧羊犬");
        dog1.setAge(3);
        dog1.setColor("黑色");
        System.out.println("名称："+dog1.getName()+"，年龄"+dog1.getAge()+"颜色."+dog1.getColor());
    }
}
